import React from 'react';
import { Modal, Button } from 'antd';

import useModal from '@antelopecloud/hooks/lib/useModal';



const AntelopeCloud = () => {

  // const url = 'https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1597388955&di=d531f1598ad07764f588480d41df1cca&src=http://a3.att.hudong.com/14/75/01300000164186121366756803686.jpg'
  // const url = '/home_bg.png'
  // const image = handeleImage();

  // image.urlToImage(url,(img:any)=>{
  //   console.log(img);
  //   const canvas = image.imagetoCanvas(img)
  //   console.log(canvas);
  //   image.canvasResizetoFile(canvas,0,(blob:any)=>{
  //     console.log(blob);
  //     const file = image.blobToFile(blob)
  //     console.log(file);

  //   })

  // })

  const { type, visible, toggle, setTypeWithVisible } = useModal();


  return (



    <>
      <Button onClick={() => { setTypeWithVisible('add') }}> 新增</Button>
      <Button onClick={() => { setTypeWithVisible('update') }}> 编辑</Button>
      <Modal
        visible={visible}
        title={type === 'add' ? `新增` : '编辑'}
        onOk={toggle}
        onCancel={toggle}
        okText='确认'
        cancelText='取消'
      >
        测试
      </Modal>
    </>
  )
}

export default AntelopeCloud;